#include <cstdio>
#include <algorithm>
using namespace std;
const int N = 100005;
struct node {
	long long x, t;
}d[N];
long long n, m, ans;
bool cmp (node x, node y) {
	return x.x + x.t < y.x + y.t;
}
int main() {
	scanf ("%lld%lld", &n, &m);
	int a, b;
	for (long long i = 1; i <= n; i++) {
		scanf ("%lld%lld", &a, &b);
		d[i].x = a;
		d[i].t = b;	
	}
	sort (d + 1, d + n + 1, cmp);
	long long cur = 0;
	long long tmp = 0;
	for (long long i = 1; i <= n; i++) {
		if (tmp + d[i].x + d[i].t - cur > m) {
			break;
		}
		tmp += d[i].x + d[i].t - cur;
		cur = d[i].x;
		ans++; 
	}
	printf ("%lld\n", ans);
	return 0;
}
